home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / SmallTalk / Symbol.st < prev    next >
Text File  |  1995-08-25  |  2KB  |  101 lines

  1. "======================================================================
  2. |
  3. |   Symbol Method Definitions
  4. |
  5.  ======================================================================"
  6.  
  7.  
  8. "======================================================================
  9. |
  10. | Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
  11. | Written by Steve Byrne.
  12. |
  13. | This file is part of GNU Smalltalk.
  14. |
  15. | GNU Smalltalk is free software; you can redistribute it and/or modify it
  16. | under the terms of the GNU General Public License as published by the Free
  17. | Software Foundation; either version 1, or (at your option) any later version.
  18. | GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
  19. | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  20. | FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  21. | details.
  22. | You should have received a copy of the GNU General Public License along with
  23. | GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
  24. | Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
  25. |
  26.  ======================================================================"
  27.  
  28.  
  29. "
  30. |     Change Log
  31. | ============================================================================
  32. | Author       Date       Change 
  33. | sbb         16 Mar 91      Class creation now separate statement.
  34. |
  35. | sbb         21 Sep 90      Added printOn: to print the un-sharped version of the
  36. |              symbol, since string printOn: changed.
  37. |
  38. | sbyrne     19 Sep 89      Changed to use real method categories.
  39. |
  40. | sbyrne     25 Apr 89      created.
  41. |
  42. "
  43.  
  44. String variableByteSubclass: #Symbol
  45.        instanceVariableNames: ''
  46.        classVariableNames: ''
  47.        poolDictionaries: ''
  48.        category: nil
  49. !
  50.  
  51. Symbol comment: 
  52. 'My instances are unique throughout the Smalltalk system.  My instances 
  53. behave for the most part like strings, except that they print differently,
  54. and I guarantee that any two instances that have the same printed 
  55. representation are in fact the same instance.' !
  56.  
  57. !Symbol class methodsFor: 'instance creation'!
  58.  
  59. internCharacter: aCharacter
  60.     | s |
  61.     s _ String new: 1.
  62.     s at: 1 put: aCharacter.
  63.     ^self intern: s
  64. !!
  65.  
  66.  
  67.  
  68. !Symbol methodsFor: 'converting'!
  69.  
  70. asSymbol
  71.     ^self
  72. !!
  73.  
  74.  
  75.  
  76. !Symbol methodsFor: 'misc'!
  77.  
  78. species
  79.     ^String
  80. !!
  81.  
  82.  
  83.  
  84. !Symbol methodsFor: 'printing'!
  85.  
  86. printOn: aStream
  87.     aStream nextPutAll: self
  88. !!
  89.  
  90.  
  91.  
  92. !Symbol methodsFor: 'storing'!
  93.  
  94. storeOn: aStream
  95.     aStream nextPut: $#;
  96.     nextPutAll: self
  97. !!
  98.  
  99.